/*     */ package dm.sql;
/*     */ 
/*     */ import dm.jdbc.dataConvertion.Convertion;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DmdbTimeZone2Bdta
/*     */ {
/*  19 */   byte[] value = new byte[12];
/*     */   
/*     */   private int ctype;
/*     */   
/*     */   private int prec;
/*     */   
/*     */   public DmdbTimeZone2Bdta(byte[] dt, int prec, int ctype)
/*     */   {
/*  27 */     this.value = dt;
/*  28 */     this.ctype = ctype;
/*  29 */     this.prec = prec;
/*     */   }
/*     */   
/*     */   private int getYear()
/*     */   {
/*  34 */     return Convertion.getShort(this.value, 0);
/*     */   }
/*     */   
/*     */   private short getMonth()
/*     */   {
/*  39 */     return (short)(this.value[2] & 0xFF);
/*     */   }
/*     */   
/*     */   private short getDay()
/*     */   {
/*  44 */     return (short)(this.value[3] & 0xFF);
/*     */   }
/*     */   
/*     */   private short getHour()
/*     */   {
/*  49 */     return (short)(this.value[4] & 0xFF);
/*     */   }
/*     */   
/*     */   private short getMin()
/*     */   {
/*  54 */     return (short)(this.value[5] & 0xFF);
/*     */   }
/*     */   
/*     */   private short getSec()
/*     */   {
/*  59 */     return (short)(this.value[6] & 0xFF);
/*     */   }
/*     */   
/*     */   private int getMsec()
/*     */   {
/*  64 */     return (this.value[7] & 0xFF) + (this.value[8] << 8) + (this.value[9] << 16);
/*     */   }
/*     */   
/*     */   private int getTz()
/*     */   {
/*  69 */     return Convertion.getShort(this.value, 10);
/*     */   }
/*     */   
/*     */   public String getStrFromTZ()
/*     */   {
/*  74 */     int year = getYear();
/*  75 */     short month = getMonth();
/*  76 */     short day = getDay();
/*  77 */     short hour = getHour();
/*  78 */     short min = getMin();
/*  79 */     short sec = getSec();
/*  80 */     int msec = getMsec();
/*  81 */     int tz = getTz();
/*  82 */     String str = "";
/*     */     
/*  84 */     String h = hour;
/*  85 */     String m = min;
/*  86 */     String s = sec;
/*  87 */     String n = msec;
/*     */     
/*  89 */     if (h.length() < 2)
/*     */     {
/*  91 */       h = "0" + h;
/*     */     }
/*     */     
/*  94 */     if (m.length() < 2)
/*     */     {
/*  96 */       m = "0" + m;
/*     */     }
/*     */     
/*  99 */     if (s.length() < 2)
/*     */     {
/* 101 */       s = "0" + s;
/*     */     }
/*     */     
/* 104 */     if (this.prec > 0)
/*     */     {
/* 106 */       int nlen = n.length();
/* 107 */       if (nlen < 6)
/*     */       {
/* 109 */         for (int i = 0; i < 6 - nlen; i++)
/* 110 */           n = "0" + n;
/*     */       }
/* 112 */       if (n.length() > this.prec)
/*     */       {
/* 114 */         n = n.substring(0, this.prec);
/*     */       }
/*     */     }
/*     */     
/* 118 */     if (this.ctype == 2)
/*     */     {
/* 120 */       str = str + year;
/*     */       
/* 122 */       String mon = month;
/* 123 */       if (mon.length() < 2) {
/* 124 */         mon = "0" + mon;
/*     */       }
/* 126 */       String d = day;
/* 127 */       if (d.length() < 2) {
/* 128 */         d = "0" + d;
/*     */       }
/* 130 */       str = str + "-" + mon + "-" + d + " ";
/*     */     }
/*     */     
/* 133 */     if (this.prec == 0) {
/* 134 */       str = str + h + ":" + m + ":" + s;
/*     */     } else {
/* 136 */       str = str + h + ":" + m + ":" + s + "." + n;
/*     */     }
/* 138 */     if (tz >= 0) {
/* 139 */       str = str + " +";
/*     */     } else {
/* 141 */       str = str + " -";
/*     */     }
/* 143 */     int tz_hour = Math.abs(tz / 60);
/* 144 */     int tz_min = Math.abs(tz % 60);
/*     */     
/* 146 */     String tz_hour_s = tz_hour;
/* 147 */     String tz_min_s = tz_min;
/* 148 */     if (tz_hour_s.length() < 2) {
/* 149 */       tz_hour_s = "0" + tz_hour_s;
/*     */     }
/* 151 */     if (tz_min_s.length() < 2) {
/* 152 */       tz_min_s = "0" + tz_min_s;
/*     */     }
/* 154 */     str = str + tz_hour_s + ":" + tz_min_s;
/*     */     
/* 156 */     return str;
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/* 161 */     return getStrFromTZ();
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\sql\DmdbTimeZone2Bdta.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */